package com.bulemobi.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.jsyh.hcb.R;

import java.util.ArrayList;

/**
 * Created by 武 on 2014/9/20 0020.
 * 应急服务listAdapter
 */
public class EmergencyAdapter extends BaseAdapter{
    private Context mContext;
    private LayoutInflater layoutInflater;
    private ArrayList<String> roadLineList;

    public EmergencyAdapter(Context context, ArrayList<String> list) {
        this.mContext = context;
        this.roadLineList = list;
        this.layoutInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return roadLineList == null ? 0 : roadLineList.size();
    }

    @Override
    public Object getItem(int position) {
        return roadLineList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        TextView tx_name;
        ImageView jiantou;
        if (null == mContext) {
            return null;
        }
        if (null == convertView) {
            convertView = layoutInflater.from(mContext).inflate(R.layout.ac_nearby_lv_it,null);
        }
        tx_name = (TextView) convertView.findViewById(R.id.tx_name);
        jiantou = (ImageView) convertView.findViewById(R.id.jiantou);
        if(position!=0){
            jiantou.setVisibility(View.INVISIBLE);
        }
        tx_name.setText(roadLineList.get(position));
        return convertView;
    }
}
